import { createPinia } from 'pinia'
// import persist from 'pinia-plugin-persistedstate'
import { createPersistedState } from 'pinia-plugin-persistedstate'

const pinia = createPinia()
// 使用持久化存储插件
// pinia.use(persist)
pinia.use(
  createPersistedState({
    // 持久化兼容多端
    storage: {
      setItem(key, value) {
        uni.setStorageSync(key, value)
      },
      getItem(key) {
        return uni.getStorageSync(key)
      },
    },
  }),
)

// 默认导出，给main.ts文件使用
export default pinia

// 模块统一导出
export * from './modules/member'
export * from './modules/address'
